# Timezones.py --- a mapping of windows timezones to Olson timezones.
# It has been generated using the get_windows_info from tzlocal
# (https://github.com/regebro/tzlocal)
import pytz

windows_timezones = {
    'AUS Central Standard Time': 'Australia/Darwin',
    'AUS Eastern Standard Time': 'Australia/Sydney',
    'Afghanistan Standard Time': 'Asia/Kabul',
    'Alaskan Standard Time': 'America/Anchorage',
    'Arab Standard Time': 'Asia/Riyadh',
    'Arabian Standard Time': 'Asia/Dubai',
    'Arabic Standard Time': 'Asia/Baghdad',
    'Argentina Standard Time': 'America/Buenos_Aires',
    'Atlantic Standard Time': 'America/Halifax',
    'Azerbaijan Standard Time': 'Asia/Baku',
    'Azores Standard Time': 'Atlantic/Azores',
    'Bahia Standard Time': 'America/Bahia',
    'Bangladesh Standard Time': 'Asia/Dhaka',
    'Belarus Standard Time': 'Europe/Minsk',
    'Canada Central Standard Time': 'America/Regina',
    'Cape Verde Standard Time': 'Atlantic/Cape_Verde',
    'Caucasus Standard Time': 'Asia/Yerevan',
    'Cen. Australia Standard Time': 'Australia/Adelaide',
    'Central America Standard Time': 'America/Guatemala',
    'Central Asia Standard Time': 'Asia/Almaty',
    'Central Brazilian Standard Time': 'America/Cuiaba',
    'Central Europe Standard Time': 'Europe/Budapest',
    'Central European Standard Time': 'Europe/Warsaw',
    'Central Pacific Standard Time': 'Pacific/Guadalcanal',
    'Central Standard Time': 'America/Chicago',
    'Central Standard Time (Mexico)': 'America/Mexico_City',
    'China Standard Time': 'Asia/Shanghai',
    'Dateline Standard Time': 'Etc/GMT+12',
    'E. Africa Standard Time': 'Africa/Nairobi',
    'E. Australia Standard Time': 'Australia/Brisbane',
    'E. Europe Standard Time': 'Europe/Chisinau',
    'E. South America Standard Time': 'America/Sao_Paulo',
    'Eastern Standard Time': 'America/New_York',
    'Eastern Standard Time (Mexico)': 'America/Cancun',
    'Egypt Standard Time': 'Africa/Cairo',
    'Ekaterinburg Standard Time': 'Asia/Yekaterinburg',
    'FLE Standard Time': 'Europe/Kiev',
    'Fiji Standard Time': 'Pacific/Fiji',
    'GMT Standard Time': 'Europe/London',
    'GTB Standard Time': 'Europe/Bucharest',
    'Georgian Standard Time': 'Asia/Tbilisi',
    'Greenland Standard Time': 'America/Godthab',
    'Greenwich Standard Time': 'Atlantic/Reykjavik',
    'Hawaiian Standard Time': 'Pacific/Honolulu',
    'India Standard Time': 'Asia/Calcutta',
    'Iran Standard Time': 'Asia/Tehran',
    'Israel Standard Time': 'Asia/Jerusalem',
    'Jordan Standard Time': 'Asia/Amman',
    'Kaliningrad Standard Time': 'Europe/Kaliningrad',
    'Korea Standard Time': 'Asia/Seoul',
    'Libya Standard Time': 'Africa/Tripoli',
    'Line Islands Standard Time': 'Pacific/Kiritimati',
    'Magadan Standard Time': 'Asia/Magadan',
    'Mauritius Standard Time': 'Indian/Mauritius',
    'Middle East Standard Time': 'Asia/Beirut',
    'Montevideo Standard Time': 'America/Montevideo',
    'Morocco Standard Time': 'Africa/Casablanca',
    'Mountain Standard Time': 'America/Denver',
    'Mountain Standard Time (Mexico)': 'America/Chihuahua',
    'Myanmar Standard Time': 'Asia/Rangoon',
    'N. Central Asia Standard Time': 'Asia/Novosibirsk',
    'Namibia Standard Time': 'Africa/Windhoek',
    'Nepal Standard Time': 'Asia/Katmandu',
    'New Zealand Standard Time': 'Pacific/Auckland',
    'Newfoundland Standard Time': 'America/St_Johns',
    'North Asia East Standard Time': 'Asia/Irkutsk',
    'North Asia Standard Time': 'Asia/Krasnoyarsk',
    'North Korea Standard Time': 'Asia/Pyongyang',
    'Pacific SA Standard Time': 'America/Santiago',
    'Pacific Standard Time': 'America/Los_Angeles',
    'Pacific Standard Time (Mexico)': 'America/Santa_Isabel',
    'Pakistan Standard Time': 'Asia/Karachi',
    'Paraguay Standard Time': 'America/Asuncion',
    'Romance Standard Time': 'Europe/Paris',
    'Russia Time Zone 10': 'Asia/Srednekolymsk',
    'Russia Time Zone 11': 'Asia/Kamchatka',
    'Russia Time Zone 3': 'Europe/Samara',
    'Russian Standard Time': 'Europe/Moscow',
    'SA Eastern Standard Time': 'America/Cayenne',
    'SA Pacific Standard Time': 'America/Bogota',
    'SA Western Standard Time': 'America/La_Paz',
    'SE Asia Standard Time': 'Asia/Bangkok',
    'Samoa Standard Time': 'Pacific/Apia',
    'Singapore Standard Time': 'Asia/Singapore',
    'South Africa Standard Time': 'Africa/Johannesburg',
    'Sri Lanka Standard Time': 'Asia/Colombo',
    'Syria Standard Time': 'Asia/Damascus',
    'Taipei Standard Time': 'Asia/Taipei',
    'Tasmania Standard Time': 'Australia/Hobart',
    'Tokyo Standard Time': 'Asia/Tokyo',
    'Tonga Standard Time': 'Pacific/Tongatapu',
    'Turkey Standard Time': 'Europe/Istanbul',
    'US Eastern Standard Time': 'America/Indianapolis',
    'US Mountain Standard Time': 'America/Phoenix',
    'UTC': 'Etc/GMT',
    'UTC+12': 'Etc/GMT-12',
    'UTC-02': 'Etc/GMT+2',
    'UTC-11': 'Etc/GMT+11',
    'Ulaanbaatar Standard Time': 'Asia/Ulaanbaatar',
    'Venezuela Standard Time': 'America/Caracas',
    'Vladivostok Standard Time': 'Asia/Vladivostok',
    'W. Australia Standard Time': 'Australia/Perth',
    'W. Central Africa Standard Time': 'Africa/Lagos',
    'W. Europe Standard Time': 'Europe/Berlin',
    'West Asia Standard Time': 'Asia/Tashkent',
    'West Pacific Standard Time': 'Pacific/Port_Moresby',
    'Yakutsk Standard Time': 'Asia/Yakutsk'
}

# Also add the friendly timezone names

UTC_friendly_timezones = {
    '(UTC-12:00) International Date Line West': 'Etc/GMT+12',
    '(UTC-11:00) Coordinated Universal Time-11': 'Etc/GMT+11',
    '(UTC-10:00) Hawaii': 'Pacific/Honolulu',
    '(UTC-09:00) Alaska': 'America/Anchorage',
    '(UTC-08:00) Baja California': 'America/Los_Angeles',
    '(UTC-08:00) Pacific Time (US & Canada)': 'America/Los_Angeles',
    '(UTC-07:00) Arizona': 'America/Phoenix',
    '(UTC-07:00) Chihuahua, La Paz, Mazatlan': 'America/Chihuahua',
    '(UTC-07:00) Mountain Time (US & Canada)': 'America/Denver',
    '(UTC-06:00) Central America': 'America/Guatemala',
    '(UTC-06:00) Central Time (US & Canada)': 'America/Chicago',
    '(UTC-06:00) Guadalajara, Mexico City, Monterrey': 'America/Mexico_City',
    '(UTC-06:00) Saskatchewan': 'America/Regina',
    '(UTC-05:00) Bogota, Lima, Quito': 'America/Bogota',
    '(UTC-05:00) Bogota, Lima, Quito, Rio Branco': 'America/Bogota',
    '(UTC-05:00) Eastern Time (US & Canada)': 'America/New_York',
    '(UTC-05:00) Indiana (East)': 'America/Indianapolis',
    '(UTC-04:30) Caracas': 'America/Caracas',
    '(UTC-04:00) Asuncion': 'America/Asuncion',
    '(UTC-04:00) Atlantic Time (Canada)': 'America/Halifax',
    '(UTC-04:00) Cuiaba': 'America/Cuiaba',
    '(UTC-04:00) Georgetown, La Paz, Manaus, San Juan': 'America/La_Paz',
    '(UTC-03:00) Santiago': 'America/Santiago',
    '(UTC-03:30) Newfoundland': 'America/St_Johns',
    '(UTC-03:30) Newfoundland and Labrador': 'America/St_Johns',
    '(UTC-03:00) Brasilia': 'America/Sao_Paulo',
    '(UTC-03:00) Buenos Aires': 'America/Buenos_Aires',
    '(UTC-03:00) Buenos Aires, Georgetown': 'America/Buenos_Aires',
    '(UTC-03:00) Cayenne, Fortaleza': 'America/Cayenne',
    '(UTC-03:00) Greenland': 'America/Godthab',
    '(UTC-03:00) Montevideo': 'America/Montevideo',
    '(UTC-03:00) Salvador': 'America/Bahia',
    '(UTC-02:00) Coordinated Universal Time-02': 'America/Noronha',
    '(UTC-02:00) Mid-Atlantic': 'Etc/GMT-2',
    '(UTC-01:00) Azores': 'Atlantic/Azores',
    '(UTC-01:00) Cabo Verde Is.': 'Atlantic/Cape_Verde',
    '(UTC-01:00) Cape Verde Islands': 'Atlantic/Cape_Verde',
    '(UTC) Casablanca': 'Africa/Casablanca',
    '(UTC) Coordinated Universal Time': 'Etc/GMT',
    '(UTC) Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London': 'Etc/GMT',
    '(UTC) Dublin, Edinburgh, Lisbon, London': 'Europe/London',
    '(UTC) Monrovia, Reykjavik': 'Atlantic/Reykjavik',
    '(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna': 'Europe/Berlin',
    '(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague': 'Europe/Budapest',
    '(UTC+01:00) Brussels, Copenhagen, Madrid, Paris': 'Europe/Paris',
    '(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb': 'Europe/Warsaw',
    '(UTC+01:00) West Central Africa': 'Africa/Lagos',
    '(UTC+01:00) Windhoek': 'Africa/Windhoek',
    '(UTC+02:00) Amman': 'Asia/Amman',
    '(UTC+02:00) Athens, Bucharest': 'Europe/Bucharest',
    '(UTC+02:00) Athens, Istanbul, Minsk': 'Europe/Bucharest',
    '(UTC+02:00) Bucharest': 'Europe/Bucharest',
    '(UTC+02:00) Beirut': 'Asia/Beirut',
    '(UTC+02:00) Cairo': 'Africa/Cairo',
    '(UTC+02:00) Damascus': 'Asia/Damascus',
    '(UTC+02:00) E. Europe': 'Europe/Chisinau',
    '(UTC+02:00) Harare, Pretoria': 'Africa/Johannesburg',
    '(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius': 'Europe/Kiev',
    '(UTC+02:00) Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius': 'Europe/Kiev',
    '(UTC+02:00) Istanbul': 'Europe/Istanbul',
    '(UTC+02:00) Jerusalem': 'Asia/Jerusalem',
    '(UTC+02:00) Kaliningrad (RTZ 1)': 'Europe/Kaliningrad',
    '(UTC+02:00) Tripoli': 'Africa/Tripoli',
    '(UTC+03:00) Baghdad': 'Asia/Baghdad',
    '(UTC+03:00) Kuwait, Riyadh': 'Asia/Riyadh',
    '(UTC+03:00) Minsk': 'Europe/Minsk',
    '(UTC+03:00) Moscow, St. Petersburg, Volgograd': 'Europe/Moscow',
    '(UTC+03:00) Moscow, St. Petersburg, Volgograd (RTZ 2)': 'Europe/Moscow',
    '(UTC+03:00) Nairobi': 'Africa/Nairobi',
    '(UTC+03:30) Tehran': 'Asia/Tehran',
    '(UTC+04:00) Abu Dhabi, Muscat': 'Asia/Dubai',
    '(UTC+04:00) Baku': 'Asia/Baku',
    '(UTC+04:00) Baku, Tbilisi, Yerevan': 'Asia/Baku',
    '(UTC+04:00) Izhevsk, Samara (RTZ 3)': 'Europe/Samara',
    '(UTC+04:00) Port Louis': 'Indian/Mauritius',
    '(UTC+04:00) Tbilisi': 'Asia/Tbilisi',
    '(UTC+04:00) Yerevan': 'Asia/Yerevan',
    '(UTC+04:30) Kabul': 'Asia/Kabul',
    '(UTC+05:00) Ashgabat, Tashkent': 'Asia/Tashkent',
    '(UTC+05:00) Ekaterinburg': 'Asia/Yekaterinburg',
    '(UTC+05:00) Ekaterinburg (RTZ 4)': 'Asia/Yekaterinburg',
    '(UTC+05:00) Islamabad, Karachi': 'Asia/Karachi',
    '(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi': 'Asia/Calcutta',
    '(UTC+06:00) Sri Jayawardenepura': 'Asia/Colombo',
    '(UTC+05:45) Kathmandu': 'Asia/Katmandu',
    '(UTC+06:00) Astana': 'Asia/Almaty',
    '(UTC+06:00) Astana, Dhaka': 'Asia/Almaty',
    '(UTC+06:00) Dhaka': 'Asia/Dhaka',
    '(UTC+06:00) Almaty, Novosibirsk': 'Asia/Novosibirsk',
    '(UTC+06:00) Novosibirsk (RTZ 5)': 'Asia/Novosibirsk',
    '(UTC+06:30) Yangon Rangoon': 'Asia/Rangoon',
    '(UTC+06:30) Yangon (Rangoon)': 'Asia/Rangoon',
    '(UTC+07:00) Bangkok, Hanoi, Jakarta': 'Asia/Bangkok',
    '(UTC+07:00) Krasnoyarsk': 'Asia/Krasnoyarsk',
    '(UTC+07:00) Krasnoyarsk (RTZ 6)': 'Asia/Krasnoyarsk',
    '(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi': 'Asia/Shanghai',
    '(UTC+08:00) Irkutsk, Ulaanbaatar': 'Asia/Irkutsk',
    '(UTC+08:00) Irkutsk (RTZ 7)': 'Asia/Irkutsk',
    '(UTC+08:00) Kuala Lumpur, Singapore': 'Asia/Singapore',
    '(UTC+08:00) Perth': 'Australia/Perth',
    '(UTC+08:00) Taipei': 'Asia/Taipei',
    '(UTC+08:00) Ulaanbaatar': 'Asia/Ulaanbaatar',
    '(UTC+09:00) Osaka, Sapporo, Tokyo': 'Asia/Tokyo',
    '(UTC+09:00) Seoul': 'Asia/Seoul',
    '(UTC+09:00) Yakutsk': 'Asia/Yakutsk',
    '(UTC+09:00) Yakutsk (RTZ 8)': 'Asia/Yakutsk',
    '(UTC+09:30) Adelaide': 'Australia/Adelaide',
    '(UTC+09:30) Darwin': 'Australia/Darwin',
    '(UTC+10:00) Brisbane': 'Australia/Brisbane',
    '(UTC+10:00) Canberra, Melborune, Sydney': 'Australia/Sydney',
    '(UTC+10:00) Guam, Port Moresby': 'Pacific/Port_Moresby',
    '(UTC+10:00) Hobart': 'Australia/Hobart',
    '(UTC+10:00) Magadan': 'Asia/Magadan',
    '(UTC+10:00) Vladivostok': 'Asia/Vladivostok',
    '(UTC+10:00) Vladivostok, Magadan (RTZ 9)': 'Asia/Vladivostok',
    '(UTC+11:00) Chokurdakh (RTZ 10)': 'Asia/Srednekolymsk',
    '(UTC+11:00) Solomon Is., New Caledonia': 'Pacific/Guadalcanal',
    '(UTC+12:00) Auckland, Wellington': 'Pacific/Auckland',
    '(UTC+12:00) Coordinated Universal Time+12': 'Pacific/Tarawa',
    '(UTC+12:00) Fiji': 'Pacific/Fiji',
    '(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky': 'Asia/Kamchatka',
    '(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky (RTZ 11)': 'Asia/Kamchatka',
    '(UTC+13:00) Nuku\'alofa': 'Pacific/Tongatapu',
    '(UTC+13:00) Samoa': 'Pacific/Apia',
    '(UTC+14:00) Kiritimati Island': 'Pacific/Kiritimati'
}

# UTC and GMT are equivalent, and some servers can send the GMT version
GMT_friendly_timezones = {k.replace('(UTC', '(GMT'): v for k, v in UTC_friendly_timezones.items()}

# Also add the Olson DB timezones (e.g: Europe/Paris, etc.)
olson_timezones = {tz: tz for tz in pytz.all_timezones}

# Also add really strange formats we've seen in calendar events
awful_timezones = {
    'Pacific': 'America/Los_Angeles',
    'US/PST': 'America/Los_Angeles',
    'Mountain': 'America/Denver',
    'US/MT': 'America/Denver',
    'Central': 'America/Chicago',
    'US/CST': 'America/Chicago',
    'Eastern': 'America/New_York',
    'US/EST': 'America/New_York'
}

timezones_table = {}
timezones_table.update(windows_timezones)
timezones_table.update(olson_timezones)
timezones_table.update(UTC_friendly_timezones)
timezones_table.update(GMT_friendly_timezones)
timezones_table.update(awful_timezones)
